﻿using CompanyManageSystem.IService;
using CompanyManageSystem.Model;
using CompanyManageSystem.Service;
using DevExpress.Spreadsheet;
using DevExpress.XtraGrid.Columns;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CompanyManageSystem.UI.Info
{
    public partial class Other : Form
    {

        public Other()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 窗体加载完成
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Other_Load(object sender, EventArgs e)
        {
            //PSContext _db = new PSContext();
            //gridControl1.DataSource = _db.Materials.ToList();
        }

        /// <summary>
        /// 按钮点击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            //var material = gridView1.GetFocusedRow() as Material;

            //ITestService service = new TestService();
            //service.UpdateMaterial(material);

            //存储过程的使用
            PSContext _db = new PSContext();
            _db.Database.CommandTimeout = 180;
            Type t = typeof(CompanyStaffInfoDTO);
            SqlParameter[] para = new SqlParameter[1];
            para[0] = new SqlParameter("@sYear", textEdit1.Text.Trim());
            var data = _db.Database.SqlQuery(t, "exec dbo.MyProc2 @sYear", para).Cast<CompanyStaffInfoDTO>().ToList();
            this.gridControl1.DataSource = data;

        }

    }
}
